#pragma once
#include "bondlib.h"

class StringPtrMapImpl;
class BondKeyMapImpl;
class S_BONDLIB_EXPORT StringPtrMap
{
public:
	enum kKeyMode{
		kKeyModeAsKey,
		kKeyModeAsCode
	};
protected:
	typedef BondKeyMapImpl KeyMapImpl;
	KeyMapImpl*			m_impl;
	kKeyMode			m_mode;
public:
	StringPtrMap(kKeyMode mode);
	~StringPtrMap();
	void SetAt(const char* key,void* ptr);
	bool Lookup(const char* key,void*& ptr);
	bool RemoveKey(const char* key);
	void RemoveAll();
	void InitHashTable(int capcity);
	int GetLength()const;
public://调试用
	void DumpStatus(int mode = 0)const;
protected:
	double GetHashRatio()const;
	
	int GetBytes()const;
	void Expand(int length);
	void ExpandByRatio(double ratio);
};
